﻿<Page x:Class="PFC.Program.Profile.Pages.CategoriesPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:PFC.Program.Profile.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="400" 
      d:DesignWidth="800"
      Title="CategoriesPage">

    <Page.Resources>

        <!--Кастомный ListBox-->
        <DataTemplate x:Key="CustomListBox">
            <Grid Background="White">

                <Label Content="{Binding Name}"
                       Grid.Column="0"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       BorderBrush="#FFFF8000"
                       BorderThickness="1"
                       FontSize="15"
                       FontFamily="Calibri"
                       Width="225"
                       Margin="5">

                    <Label.Resources>
                        <Style TargetType="Border">
                            <Setter Property="CornerRadius" 
                                    Value="5"/>
                        </Style>
                    </Label.Resources>

                </Label>

            </Grid>
        </DataTemplate>
    </Page.Resources>

    <Grid Background="#FFFF8000">

        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="220"/>
            <RowDefinition Height="100"/>
        </Grid.RowDefinitions>

        <Button Name="BackBtn"
                Content="Назад"
                Style="{DynamicResource ButtonStyle}"
                VerticalAlignment="Center"
                Click="BackBtn_Click" Height="34" Margin="360,0,360,0"/>

        <Label Content="Категории транзакций"
               Grid.Row="1"
               FontFamily="Calibri"
               FontSize="20"
               Foreground="White"
               HorizontalAlignment="Center"
               VerticalAlignment="Top"/>

        <ListBox Name="ListCategories_Lbx"
                 Grid.Row="1"
                 ItemTemplate="{DynamicResource CustomListBox}"
                 d:ItemsSource="{d:SampleData ItemCount=3}"
                 Height="180"
                 Width="280"
                 Margin="0 0 0 5"
                 VerticalAlignment="Bottom"
                 SelectionChanged="ListCategories_Lbx_SelectionChanged" >
            <ListBox.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="5"/>
                </Style>
            </ListBox.Resources>
        </ListBox>

        <TextBox Name="InputNewCategory_Txb"
                 Grid.Row="2"
                 Height="30"
                 Width="280"
                 VerticalAlignment="Top"
                 FontSize="15"
                 VerticalContentAlignment="Center">
            <TextBox.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="5"/>
                </Style>
            </TextBox.Resources>
        </TextBox>

        <Button Name="AddNewCategory_Btn"
                Grid.Row="2"
                Content="Добавить"
                Style="{DynamicResource ButtonStyle}"
                VerticalAlignment="Bottom"                Margin="180 0 0 30"
                Click="AddNewCategory_Btn_Click" 
                Height="35"
                Width="100"/>

        <Button Name="DeleteSelectedCategory_Btn"
                Grid.Row="2"
                Content="Удалить"
                Style="{DynamicResource ButtonStyle}"
                VerticalAlignment="Bottom"                Margin="0 0 180 30"
                Click="DeleteSelectedCategory_Btn_Click" 
                Height="35"
                Width="100"/>

    </Grid>
</Page>
